/*
 * @lc app=leetcode.cn id=617 lang=javascript
 *
 * [617] 合并二叉树
 */

// @lc code=start
/**
 * Definition for a binary tree node.
 * function TreeNode(val) {
 *     this.val = val;
 *     this.left = this.right = null;
 * }
 */
/**
 * @param {TreeNode} t1
 * @param {TreeNode} t2
 * @return {TreeNode}
 */
var mergeTrees = function(t1, t2) {
    let root=new TreeNode()
    if(!t1||!t2){
        return t1||t2
    }
    root.val=t1.val+t2.val
    root.left=mergeTrees(t1.left,t2.left)
    root.right=mergeTrees(t1.right,t2.right)
    return root
};//一种直接在T1上面修改
//一种直接new 一个节点然后修改
// @lc code=end

